import xodr.importer.XODRInputReader;
import xodr.importer.XODRParser;
import xodr.map.MapDataContainer;
import xodr.map.entity.Road;

import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

public class OpenDriveConvert {

    public static void OpenDrive() {
        //openDrivePath：输入xodr文件得路径，eg:D:\gitee\open-drive-convert\src\main\resources\maps\Town04.xodr
        String openDrivePath = "D:\\github\\open-drive-convert\\src\\main\\resources\\maps\\Town04.xodr";
        String input = XODRInputReader.readFromFile(openDrivePath);
        MapDataContainer container = XODRParser.parse(input);
        System.out.println(container.getRoads().get(1));
    }

    public static void main(String[] args) {
        OpenDrive();
    }


    static void fileWrite(String str) {
        FileWriter fw = null;
        try {
            fw = new FileWriter("D:\\road.txt", true);
            fw.write(str+"\r\n");//这里向文件中输入结果123
            fw.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fw != null) {
                try {
                    fw.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}
